/*
 * @lc app=leetcode.cn id=242 lang=cpp
 *
 * [242] 有效的字母异位词
 */

#include <limits.h>

#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;

// @lc code=start
class Solution {
   public:
    bool isAnagram(string s, string t) {
        bool result = true;
        vector<int> s_count(30, 0);
        vector<int> t_count(30, 0);

        for (char c : s) {
            s_count[c - 'a']++;
        }
        for (char c : t) {
            t_count[c - 'a']++;
        }

        for (int i = 0; i < 26; i++) {
            if (s_count[i] != t_count[i]) {
                result = false;
                break;
            }
        }

        return result;
    }
};
// @lc code=end
